import{service} from '@/utils/request'

export function getClass(id,pageNum,pageSize) {
    return service({
      url: `/api/orgs/class/searchClassByDeptId/${pageNum}/${pageSize}?deptId=${id}`,
      method: 'get'
    })
}

export function searchClassByName(queryInfo) {
    return  service({
      url: `/api/orgs/class/searchClassByClassName/${queryInfo.pageNum}/${queryInfo.pageSize}?classname=${queryInfo.query}`,
      method: 'get'
    })
}

export async function addClass(data) {
    return await service({
      url: `/api/orgs/class/`,
      method: 'post',
      data
    })
}

export function updateClass(classId, data) {
    return service({
      url: `/api/orgs/class/updateClassById/${classId}`,
      method: 'put',
      data
    })
}

export function deleteClass(id,data) {
    return service({
      url: `/api/orgs/class/${id}`,
      method: 'delete',
      data
    })
  }

  // 导出Excel表格
export function exportExcel() {
  return service({
    url: `/api/orgs/class/excel/export`,
    method: 'get',
    responseType: 'blob',
    header: {
      headers: { 'Content-Type': 'application/x-download' }
    },
  })
}